<?php

$connect = mysql_connect("localhost","root","");
mysql_select_db("orpms");

$id = addslashes($_REQUEST['id']);

$str = "SELECT avatar FROM tbl_profile,tbl_account WHERE tbl_account.account_id=$id AND tbl_account.profile_id=tbl_profile.profile_id";
$query = mysql_query($str) or die(mysql_error());
    
$get = mysql_fetch_assoc($query);
$image = $get['avatar'];

header("Content-type: image/jpeg");

echo $image;
    
?>